import request from '#/utils/requestAbort';

export async function queryPlanInfo(data) {
  return request('/tianji-transaction/interprovincialSpotDeclarationProgramInfo/queryPlanInfo', {
    method: 'POST',
    data,
  });
}

export async function queryOperateLog(data) {
  return request('/tianji-transaction/interprovincialSpotDeclarationProgramInfo/queryOperateLog', {
    method: 'POST',
    data,
  });
}

export async function getOverviewInfo(data) {
  return request('/tianji-transaction/interprovincialSpotDeclarationProgramInfo/getOverviewInfo', {
    method: 'POST',
    data,
  });
}

export async function getLimitInfo(data) {
  return request('/tianji-transaction/interprovincialSpotDeclarationProgramInfo/getLimitInfo', {
    method: 'POST',
    data,
  });
}

export async function getRegistrationList(provinceId, type) {
  return request(
    `/tianji-transaction/interprovincialSpotDeclarationProgramInfo/getRegistrationList/${provinceId}/${type}`,
    {
      method: 'GET',
    },
  );
}

export async function revokeOrder(data) {
  return request('/tianji-transaction/interprovincialSpotDeclarationProgramInfo/revokeOrder', {
    method: 'POST',
    data,
  });
}

// 保存方案
export async function saveStrategy(data) {
  return request('/tianji-transaction/interprovincialSpotDeclarationProgramInfo/saveStrategy', {
    method: 'POST',
    data,
  });
}

//立即申报
export async function immediateDeclaration(data) {
  return request(
    '/tianji-transaction/interprovincialSpotDeclarationProgramInfo/immediateDeclaration',
    {
      method: 'POST',
      data,
    },
  );
}

// 定时申报
export async function createTimeTaskDeclaration(data) {
  return request(
    '/tianji-transaction/interprovincialSpotDeclarationProgramInfo/createTimeTaskDeclaration',
    {
      method: 'POST',
      data,
    },
  );
}

// 删除方案
export async function deleteProgramInfo(data) {
  return request(
    '/tianji-transaction/interprovincialSpotDeclarationProgramInfo/deleteProgramInfo',
    {
      method: 'POST',
      data,
    },
  );
}

// 撤回定时申报
export async function cancleTimeTaskDeclaration(data) {
  return request(
    '/tianji-transaction/interprovincialSpotDeclarationProgramInfo/cancleTimeTaskDeclaration',
    {
      method: 'POST',
      data,
    },
  );
}

// 省份-交易中心-场站（数据权限）
export async function queryMarketList(menuCode) {
  return request(`/power/dataPower/common/${menuCode}/t_station`, {
    method: 'GET',
  });
}

// 日前窗口配置
export async function getDayaheadConfig(data) {
  return request(
    '/tianji-transaction/interprovincialSpotDeclarationProgramInfo/getDayaheadConfig',
    {
      method: 'POST',
      data,
    },
  );
}

export async function getHolidayByYear(marketId, year) {
  return request(
    `/tianji-transaction/interprovincialSpotDeclarationProgramInfo/getHolidayByYear/${marketId}/${year}`,
    {
      method: 'GET',
    },
  );
}

export async function saveDayaheadConfig(data) {
  return request(
    '/tianji-transaction/interprovincialSpotDeclarationProgramInfo/saveDayaheadConfig',
    {
      method: 'POST',
      data,
    },
  );
}

export async function deleteHolidayConfig(id) {
  return request(
    `/tianji-transaction/interprovincialSpotDeclarationProgramInfo/deleteHolidayConfig/${id}`,
    {
      method: 'GET',
    },
  );
}
